package com.sgcc.system.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.sgcc.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sgcc.common.log.annotation.Log;
import com.sgcc.common.log.enums.BusinessType;
import com.sgcc.common.security.annotation.PreAuthorize;
import com.sgcc.system.api.domain.SysRoleDept;
import com.sgcc.system.service.ISysRoleDeptService;
import com.sgcc.common.core.web.controller.BaseController;
import com.sgcc.common.core.web.domain.AjaxResult;
import com.sgcc.common.core.utils.poi.ExcelUtil;
import com.sgcc.common.core.web.page.TableDataInfo;

/**
 * 角色和部门关联Controller
 * 
 * @author sgcc
 * @date 2021-04-05
 */
@RestController
@RequestMapping("/roleDept")
public class SysRoleDeptController extends BaseController
{
    @Autowired
    private ISysRoleDeptService sysRoleDeptService;


    @GetMapping(value = "/{id}")
    public R<SysRoleDept> getInfo(@PathVariable("id") String id)
    {
        return R.ok(sysRoleDeptService.selectSysRoleDeptById(id));
    }

    @PostMapping
    public R<Integer> add(@RequestBody SysRoleDept sysRoleDept)
    {
        return R.ok(sysRoleDeptService.insertSysRoleDept(sysRoleDept));
    }

    @PutMapping
    public R<Integer> edit(@RequestBody SysRoleDept sysRoleDept)
    {
        return R.ok(sysRoleDeptService.updateSysRoleDept(sysRoleDept));
    }

    @PostMapping(value = "/findDeptRole")
    public R<SysRoleDept> findDeptRole(@RequestBody SysRoleDept sysRoleDept)
    {
        return R.ok(sysRoleDeptService.findDeptRole(sysRoleDept));
    }

//	@DeleteMapping("/{ids}")
//    public R<Integer> remove(@PathVariable String[] ids)
//    {
//        return R.ok(sysRoleDeptService.deleteSysRoleDeptByIds(ids));
//    }
}
